package com.bw.live_streaming.dao;

import com.bw.live_streaming.entity.SlideshowEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 
 * 
 * @author wj
 * @email sunlightcs@gmail.com
 * @date 2021-08-22 21:43:42
 */
@Mapper
public interface SlideshowDao extends BaseMapper<SlideshowEntity> {
    //根据点击量倒序排序
    @Select("SELECT * FROM `slideshow` ORDER BY slideshow_num desc")
    List<SlideshowEntity> lists();
    //点击一个该轮播图点击量+1
    @Update("UPDATE slideshow SET slideshow_num=slideshow_num+#{num} where slideshow_id=#{slideshowId}")
    void upd(@Param("slideshowId") Integer slideshowId, @Param("num") int i);
}
